#include <cstdio>
#include <vector>
#include <queue>
#include <cstring>
using namespace std;

struct edge {
	int s, e;
	double r, c;
	edge(): s(-1), e(-1), r(0), c(0) { }
	edge(int s, int e, double r, double c):
		 s(s), e(e), r(r), c(c) { }
};

#define MAXN 105

vector<edge> MAP[MAXN];
int N, M, S;
double V;
double dis[MAXN];

bool SPFA(int s, double v) {
	queue<int> q;
	bool vis[MAXN] = {0};
	int cnt[MAXN] = {0};
	for (int i=1; i<=N; i++) {
		dis[i] = 0;
	}
	dis[s] = v;
	vis[s] = true;
	q.push(s);
	
	while (!q.empty()) {
		int u = q.front(); q.pop();
		for (vector<edge>::iterator it = MAP[u].begin(); it != MAP[u].end(); it++) {
			edge e = *it;
			int v = e.e;
			double c = (dis[u]-e.c) * e.r;
			
			if (dis[v] < c) {
				//printf("%d-%d: %lf\n",u, v, c);
				dis[v] = c;
				if (!vis[v]) {
					vis[v] = true;
					cnt[v]++;
					if (cnt[v] > N) return false;
					q.push(v);
				}
			}
		}
		vis[u] = false;
	}
	return true;
}

int main() {
	scanf("%d%d%d%lf", &N, &M, &S, &V);
	for (int i=1; i<=M; i++) {
		int a, b;
		double rab, cab, rba, cba;
		scanf("%d%d%lf%lf%lf%lf", &a, &b, &rab, &cab, &rba, &cba);
		MAP[a].push_back(edge(a, b, rab, cab));
		MAP[b].push_back(edge(b, a, rba, cba));
	}
	bool r = SPFA(S, V);
	if (!r) printf("YES\n");
	else printf("NO\n");
	return 0;
}
